#include <iostream>
using namespace std;
bool IsOdd(int i)
{
	return (i%2 == 0) ? true : false;
}
int main()
{
	double sum = 0.0;
	int n;
	cout<<"Enter n @> ";
	cin>>n;
	for(int i = 0; i< n;i++)
	{
		if(IsOdd(i))
		{
			//偶数项
			sum += 1.0/(2*i + 1);
		}
		else 
		{
			//奇数项
			sum -= 1.0/(2*i + 1);
		}
	}
	cout<<"sum: "<< sum <<endl;
	return 0;
}
